package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInInvoice11;
import com.ims.core.doc.service.ITInInvoice11Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 11 增值税普通发票(卷式) Controller
 *
 * @author IMS
 * @date 2024-12-01
 */
@RestController
@RequestMapping("/doc/putongjuanshi")
public class TInInvoice11Controller extends BaseController
{
    @Autowired
    private ITInInvoice11Service tInInvoice11Service;

    /**
     * 查询11 增值税普通发票(卷式) 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInInvoice11 tInInvoice11)
    {
        startPage();
        List<TInInvoice11> list = tInInvoice11Service.selectTInInvoice11List(tInInvoice11);
        return getDataTable(list);
    }

    /**
     * 导出11 增值税普通发票(卷式) 列表
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:export')")
    @Log(title = "11 增值税普通发票(卷式) ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInInvoice11 tInInvoice11)
    {
        List<TInInvoice11> list = tInInvoice11Service.selectTInInvoice11List(tInInvoice11);
        ExcelUtil<TInInvoice11> util = new ExcelUtil<TInInvoice11>(TInInvoice11.class);
        util.exportExcel(response, list, "11 增值税普通发票(卷式) 数据");
    }

    /**
     * 获取11 增值税普通发票(卷式) 详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInInvoice11Service.selectTInInvoice11ById(id));
    }

    /**
     * 新增11 增值税普通发票(卷式) 
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:add')")
    @Log(title = "11 增值税普通发票(卷式) ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInInvoice11 tInInvoice11)
    {
        return toAjax(tInInvoice11Service.insertTInInvoice11(tInInvoice11));
    }

    /**
     * 修改11 增值税普通发票(卷式) 
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:edit')")
    @Log(title = "11 增值税普通发票(卷式) ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInInvoice11 tInInvoice11)
    {
        return toAjax(tInInvoice11Service.updateTInInvoice11(tInInvoice11));
    }

    /**
     * 删除11 增值税普通发票(卷式) 
     */
    @PreAuthorize("@ss.hasPermi('doc:putongjuanshi:remove')")
    @Log(title = "11 增值税普通发票(卷式) ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInInvoice11Service.deleteTInInvoice11ByIds(ids));
    }
}
